import 'package:built_collection/built_collection.dart';
import 'package:equatable/equatable.dart';
import 'package:mobile_app.core/core/domain/entities/learning_info/learning_info.dart';
import 'package:mobile_app.home.learning/learning_page/domain/entities/statistics_period.dart';
import 'package:mobile_app.home.learning/learning_page/domain/helpers/get_learning_duration_map/helper.dart';

part 'result.dart';

abstract class HandleLearningInfoOuterUpdate {
  LearningInfoOuterUpdateHandlingResult call({
    required LearningInfo learningInfo,
  });
}

class HandleLearningInfoOuterUpdateImpl implements HandleLearningInfoOuterUpdate {
  const HandleLearningInfoOuterUpdateImpl({
    required GetLearningDurationMap getLearningDurationMap,
  }) : _getLearningDurationMap = getLearningDurationMap;

  final GetLearningDurationMap _getLearningDurationMap;

  @override
  LearningInfoOuterUpdateHandlingResult call({
    required LearningInfo learningInfo,
  }) {
    final learningDurationMap = _getLearningDurationMap(
      learningInfo: learningInfo,
    );

    final result = LearningInfoOuterUpdateHandlingResult(
      learningDurationMap: learningDurationMap,
    );

    return result;
  }
}
